import meus from '@/api/menu'
import { getId } from '@/utils/auth'

const state = {
  menus: '',
}
const mutations = {
  SAVEMENU: (state, data) => {
    state.menus = data
  },
}
const actions = {
  async getMenu ({ commit }) {
    const adminId = 'adminId=' + getId()
    let { data } = await meus.getMenu(adminId)
    commit('SAVEMENU', data)
  },
  setMenu ({ commit }, data) {
    commit('SAVEMENU', data)
  },
}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
}

